package stars.starGroups;

import java.util.HashMap;

import com.jme3.scene.Spatial;

import model.IModel;
import utilities.Key;
import view.EViewList;
import view.AbstractView;
import view.View;
import controller.AbstractController;
import controller.IController;
import controller.PhysicalContainerEventStrategyPack;
import eventManager.AppEvent;
import eventManager.EventManager;
import eventManager.IEventData;
import eventStrategies.AddStarToGroupStrategy;
import eventStrategies.IEventResponse;
import eventStrategies.RemoveStarFromGroupStrategy;
import events.ECodeEventList;

public class StarGroupController implements IController {

	private AbstractController controller;
	private PhysicalContainerEventStrategyPack physicalContainerEventStrategyPack;
	
	public StarGroupController(EventManager eventManager) {
		this.controller = new AbstractController(eventManager);
		this.physicalContainerEventStrategyPack = new PhysicalContainerEventStrategyPack(controller);
		loadStarGroupEventStrategies();
	}
	
	private void loadStarGroupEventStrategies() {
		loadStrategy(new AddStarToGroupStrategy());
		loadStrategy(new RemoveStarFromGroupStrategy());		
	}
	
	
	//IController methods
	public void setModel(IModel model) {
		controller.setModel(model);
	}

	public void setSpatial(Spatial spatial) {
		controller.setSpatial(spatial);
	}

	public HashMap<EViewList, AbstractView> getViews() {
		return controller.getViews();
	}
	

	public HashMap<ECodeEventList, IEventResponse> getEvents() {
		return controller.getEvents();
	}
	
//	public HashMap<ECodeEventList, CodeEventStrategy> getViewEvents() {
//		return controller.getViewEvents();
//	}
//	
//	public HashMap<ECodeEventList, CodeEventStrategy> getControllerEvents() {
//		return controller.getControllerEvents();
//	}

	
	
	public void loadStrategy(IEventResponse strategy) {
		controller.loadStrategy(strategy);
	}
	
//	public void loadViewStrategy(CodeEventStrategy strategy) {
//		controller.loadStrategy(strategy);
//	}
//	
//	public void loadControllerStrategy(CodeEventStrategy strategy) {
//		controller.loadStrategy(strategy);
//	}
	

	public void processOutgoingEvent(IEventData event) {
		controller.processOutgoingEvent(event);
	}

	public void handleEvent(IEventData event) {
		controller.handleEvent(event);
	}

	public Key getKey() {
		return controller.getKey();
	}
	
	public void setKey(Key key) {
		controller.setKey(key);
	}

	

}
